<?php
    include "TopSdk.php";
    include "../function/function.php";
    date_default_timezone_set('Asia/Shanghai'); 
		$uid = '54' ;
		$PhoneCode = randomkeys(6);
	if(IS_AJAX){
		$user_phone = $_POST['phone'];
		if($user_phone == ''){
			echo 3;die;
		}
		if(getClassName("kboy_user","user_hei","user_phone='$user_phone'") == 1){
		    echo 4;die;
		}
	    $c = new TopClient;
	    $c->appkey = '23468702';
	    $c->secretKey = '3aee17b1a0591a650bc91ac7b1d0a43b';
	    $req = new AlibabaAliqinFcSmsNumSendRequest;
		$req->setExtend($uid);
		$req->setSmsType("normal");
		$req->setSmsFreeSignName("中国徒步网");
		$req->setSmsParam("{\"munder\":\"$PhoneCode\",\"product\":\"中国徒步网\"}");
		$req->setRecNum($user_phone);
		$req->setSmsTemplateCode("SMS_16755261");
		$resp = $c->execute($req);
		$data = json_decode(json_encode($resp),TRUE);
		if($data['result']['success']==true){
			$_SESSION['PhoneName'] = $user_phone;
			$_SESSION['PhoneCode'] = $PhoneCode;
			echo 1;
		}else{
			echo 2;
		};
	}
	
?>